package opengl.program;



public class LineGLProgram extends GLProgram {

	protected final static String BASE_VERT_SHADER_FILE_NAME = "..\\shader\\lineVert.glsl";
	protected final static String BASE_FRAG_SHADER_FILE_NAME = "..\\shader\\lineFrag.glsl";

	protected final static String CAMERA_MATRIX_NAME = "cameraMatrix";
	protected final static String PROJECTION_MATRIX_NAME = "projectionMatrix";
	
	// vertex shader
	protected int projectionMatrixUniform;
	private int cameraMatrixUniform;
	

	protected final static String INPUT_POSITION_NAME = "inPosition";
	protected final static String INPUT_COLOR_NAME = "inColor";


	protected int positionIndex;
	protected int colorIndex;

	public LineGLProgram() {
		super();
	}

	public void init() throws Exception {
		initShaders();
		getUniformLocations();
		getAttribLocationes();
	}

	protected void initShaders() throws Exception {
		int vs = GLShader.createVertexShader(this, BASE_VERT_SHADER_FILE_NAME);
		int fs = GLShader.createFragmentShader(this, BASE_FRAG_SHADER_FILE_NAME);
		super.initShaders(vs, fs);
	}

	protected void getUniformLocations() {
		projectionMatrixUniform = getUniformLocation(PROJECTION_MATRIX_NAME);
		cameraMatrixUniform = getUniformLocation(CAMERA_MATRIX_NAME);
	}

	protected void getAttribLocationes() {
		positionIndex = getAttribLocation(INPUT_POSITION_NAME);
		colorIndex = getAttribLocation(INPUT_COLOR_NAME);
	}

	public int getProjectionMatrixUniform() {
		return projectionMatrixUniform;
	}

	public int getCameraMatrixUniform() {
		return cameraMatrixUniform;
	}

	
	public int getPositionIndex() {
		return positionIndex;
	}

	public int getColorIndex() {
		return colorIndex;
	}
}